// pages/user/index.js

Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo:{},
    collectNum:0
  },
  /**
   * 获取用户信息
   * @param {*} e 
   */
  newGetInfo(e){
    let that = this
    wx.getUserProfile({
      desc: '正在获取', //不写不弹提示框
      success: function (res) {
        wx.setStorageSync('userInfo', res.userInfo);
        // let userInfo={
        //   avatarUrl: res.userInfo.avatarUrl,
        //   city: res.userInfo.city,
        //   country: res.userInfo.country,
        //   gender: res.userInfo.gender,
        //   language: res.userInfo.language,
        //   nickName: res.userInfo.nickName,
        //   province: res.userInfo.province
        // }
        that.setData({
          userInfo: res.userInfo
        })
      },
      fail: function (err) {
        console.log("获取失败: ", err)
      }
    })
  },
  onShow(){
    const userInfo = wx.getStorageSync("userInfo") ;
    const collect = wx.getStorageSync("collect") 
    this.setData({
      userInfo,
      collectNum:collect.length
    })
  },
  handleRefund(){
    wx.showToast({
      title: '暂不支持该功能~',
      mask: true
    });
  }
})